package com.ksd1.notes.util;

import java.util.Calendar;

public class YDTime {
    private int hour;
    private int minute;
    private int second;

    private YDTime(){};

    protected static YDTime ydtime = new YDTime();

    public static YDTime getInstance(){
        ydtime.update();
        return ydtime;
    }


    private void update(){
        Calendar calendar = Calendar.getInstance();
        hour = calendar.get(Calendar.HOUR_OF_DAY);
        minute = calendar.get(Calendar.MINUTE);
        second = calendar.get(Calendar.SECOND);
    }

    public int getHour(){return hour;}
    public int getMinute(){return minute;}
    public int getSecond(){return second;}

    public long getTimeStamp(int h, int m){
        return (h - getHour()) * 3600 + (m - getMinute())*60 - getSecond();
    }

}
